package com.csea.common.domain.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.csea.common.domain.dos.PublicIdiomDo;
import com.csea.common.domain.dos.UserIdiomDo;

import java.util.List;

public interface PublicIdiomMapper extends BaseMapper<PublicIdiomDo> {

    // 根据word模糊查询
    default List<PublicIdiomDo> selectByWordLike(String word){
        return selectList(new QueryWrapper<PublicIdiomDo>().like("word",word));
    }

    // 根据keyword模糊查询成语
    default List<PublicIdiomDo> selectByKeywordLike(String keyword){
        return selectList(new LambdaQueryWrapper<PublicIdiomDo>()
                .like(PublicIdiomDo::getWord, keyword)
                .or()
                .like(PublicIdiomDo::getSynonyms, keyword)
        );
    }


}
